/**************************************************************************
 *  创建者：        hualei
 *  开始时间：   2018.09.28
 *  copyright:  (C) 深圳市华友高科有限公司
 *  修改说明：  (每次有修改就添加一条，带有 修改人，修改时间，修改描述)
 *
 ***************************************************************************
 *   LIFT 升降机构指令属性编辑视窗逻辑处理类
 *
 ***************************************************************************/
#include "liftmechanisminstructiondelegate.h"

LiftMechanismInstructionDelegate::LiftMechanismInstructionDelegate(QWidget *parent)
    : QWidget(parent)
{
}

void LiftMechanismInstructionDelegate::initView()
{
    liftMechanismInstructionView->instructionStr = "LIFT";
    liftMechanismInstructionView->noteStr = "";
//    liftMechanismInstructionView->mechanismType = E_MECHANISM_GENERAL;
    liftMechanismInstructionView->liftType = E_LIFT_RISE;
}

void LiftMechanismInstructionDelegate::finishedEditInstructionSlot()
{
    liftMechanismInstructionView->instructionStr = QObject::tr("LIFT ");
    liftMechanismInstructionView->instructionStr += QObject::tr("General,");
//    if(liftMechanismInstructionView->mechanismType == E_MECHANISM_GENERAL)
//    {

//    }
//    else if(liftMechanismInstructionView->mechanismType == E_MECHANISM_HEAVY)
//    {
//        liftMechanismInstructionView->instructionStr += QObject::tr("Heavy,");
//    }

    if(liftMechanismInstructionView->liftType == E_LIFT_RISE)
    {
        liftMechanismInstructionView->instructionStr += QObject::tr("RISE,");
    }
    else if(liftMechanismInstructionView->liftType == E_LIFT_DOWN)
    {
        liftMechanismInstructionView->instructionStr += QObject::tr("DOWN,");
    }
    else if(liftMechanismInstructionView->liftType == E_LIFT_RISE_MIDDLE)
    {
        liftMechanismInstructionView->instructionStr += QObject::tr("RIMI,");
    }
    else if(liftMechanismInstructionView->liftType == E_LIFT_DOWN_MIDDLE)
    {
        liftMechanismInstructionView->instructionStr += QObject::tr("DOMI,");
    }

    liftMechanismInstructionView->instructionStr += QString::number(liftMechanismInstructionView->timeOutValue) + \
            QObject::tr(",JMP LB[") + QString::number(liftMechanismInstructionView->jmpLbValue) + "]";
    liftMechanismInstructionView->instructionStr += QObject::tr("   //") + liftMechanismInstructionView->noteStr;
}

void LiftMechanismInstructionDelegate::cleanNoteSlot()
{
    liftMechanismInstructionView->noteStr.clear();
}
